import request from '@/utils/request'

/**
 * 获取员工列表
 * @param { page, pageSize, name} params
 * @returns
 * 地址：“https://api-hmzs.itheima.net/v1/park/sys/user
 */
export function getEmployeeListAPI (params) {
  return request({
    url: '/park/sys/user',
    params
  })
}

/**
 * 查询所有角色
 *  https://api-hmzs.itheima.net/v1/park/sys/role
 * @param
 * @returns
 *
 */
export function getRoleListAPI () {
  return request({
    url: '/park/sys/role'
  })
}

/**
 * 添加员工
 * @returns
 */
export function createEmployeeAPI (data) {
  return request({
    url: `/park/sys/user`,
    method: 'POST',
    data
  })
}

/**
 * 编辑员工
 * @returns
 *  https://api-hmzs.itheima.net/v1/park/sys/user
 */
export function editEmployeeAPI (data) {
  return request({
    url: `/park/sys/user`,
    method: 'PUT',
    data
  })
}

/**
 * 删除员工
 *  https://api-hmzs.itheima.net/v1/park/sys/user/{id}
 * @returns
 */
export function delEmployeeAPI (id) {
  return request({
    url: `/park/sys/user/${id}`,
    method: 'DELETE'
  })
}
